/**
 * 显示提示消息
 * @param {string} message - 提示消息
 * @param {string} type - 提示类型 ('none' | 'success' | 'loading')
 * @param {number} duration - 显示时长(ms)
 */
export const showToast = (message, type = 'none', duration = 2000) => {
  uni.showToast({
    title: message,
    icon: type,
    duration: duration
  })
}

/**
 * 显示加载提示
 * @param {string} message - 提示消息
 */
export const showLoading = (message = '加载中...') => {
  uni.showLoading({
    title: message,
    mask: true
  })
}

/**
 * 隐藏加载提示
 */
export const hideLoading = () => {
  uni.hideLoading()
}

/**
 * 显示确认对话框
 * @param {string} title - 标题
 * @param {string} content - 内容
 * @param {boolean} showCancel - 是否显示取消按钮
 * @returns {Promise<boolean>} 用户确认结果
 */
export const showConfirm = (title, content, showCancel = true) => {
  return new Promise((resolve) => {
    uni.showModal({
      title,
      content,
      showCancel,
      success: (res) => {
        resolve(res.confirm)
      }
    })
  })
}

/**
 * 显示操作菜单
 * @param {Array<string>} items - 菜单项
 * @returns {Promise<number>} 用户选择的索引
 */
export const showActionSheet = (items) => {
  return new Promise((resolve) => {
    uni.showActionSheet({
      itemList: items,
      success: (res) => {
        resolve(res.tapIndex)
      },
      fail: () => {
        resolve(-1)
      }
    })
  })
} 